#!/usr/bin/env python

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

engine_enum = gen.enum([gen.const("Google", str_t, "Google", "Google Speech Recognition API"),
                        gen.const("GoogleCloud", str_t, "GoogleCloud", "Google Cloud Speech API"),
                        gen.const("Sphinx", str_t, "Sphinx", "CMU Sphinx API"),
                        gen.const("Wit", str_t, "Wit", "Wit.ai API"),
                        gen.const("Bing", str_t, "Bing", "Microsoft Bing Speech API"),
                        gen.const("Houndify", str_t, "Houndify", "Houndify API"),
                        gen.const("IBM", str_t, "IBM", "IBM Speech to Text API")],
                       "engine")

#       name    type     level     description     default      min      max
gen.add("language", str_t, 0, "Language", "en-US")
gen.add("engine", str_t, 0, "Recognition Engine", "Google", edit_method=engine_enum)
gen.add("energy_threshold", double_t, 0, "Threshold for Voice activity detection", 300, 10, 2000)
gen.add("dynamic_energy_threshold", bool_t, 0, "Adaptive estimation for energy_threshold", True)
gen.add("dynamic_energy_adjustment_damping", double_t, 0, "Damping threshold for dynamic VAD", 0.15, 0.0, 1.0)
gen.add("dynamic_energy_ratio", double_t, 0, "Energy ratio for dynamic VAD", 1.5, 1.0, 10.0)
gen.add("pause_threshold", double_t, 0, "Seconds of non-speaking audio before a phrase is considered complete", 0.8, 0.3, 2.0)
gen.add("operation_timeout", double_t, 0, "Seconds after an internal operation (e.g., an API request) starts before it times out", 0.0, 0.0, 60.0)
gen.add("listen_timeout", double_t, 0, "The maximum number of seconds that this will wait for a phrase to start before giving up", 0.0, 0.0, 60.0)
gen.add("phrase_time_limit", double_t, 0, "The maximum number of seconds that this will allow a phrase to continue before stopping and returning the part of the phrase processed before the time limit was reached", 10.0, 0.0, 30.0)
gen.add("phrase_threshold", double_t, 0, "Minimum seconds of speaking audio before we consider the speaking audio a phrase", 0.3, 0.001, 2.0)
gen.add("non_speaking_duration", double_t, 0, "Seconds of non-speaking audio to keep on both sides of the recording", 0.5, 0.1, 1.0)

exit(gen.generate("ros_speech_recognition", "ros_speech_recognition", "SpeechRecognition"))
